package eg.ci.mvn.service.api.model;

import lombok.Getter;

/**
 * 消息类型
 *
 * @author dev
 */
@Getter
public enum ErrorType {
	/** 缺省的成功 */
	SUCCESS("200","成功"),
	/** 缺省的失败 */
	FAILED("500", "失败"),
	/** 缺省的限流失败 */
	FAILED_LIMIT_EXCEPTION("507", "失败,被限流"),
	/** 服务调用异常 FAILED_NETFLIX_CLIENT_EXCEPTION */
	FAILED_NETFLIX_CLIENT_EXCEPTION("501", "服务调用异常"),
	/** 参数序列化异常 HttpMessageNotReadableException */
	FAILED_HTTP_MESSAGE_NOT_READABLE("502", "参数转换失败(序列化)"),
	/** 参数校验失败 MethodArgumentNotValid */
	FAILED_METHOD_ARGUMENT_NOT_VALID("503", "参数校验失败"),

	/** 路径不存在 */
	NOT_FOUND("404", "路径不存在，请检查路径是否正确"),
	LOCKED("423", "请求失败，请稍后重试"), // 并发请求，不允许

	//============================================================================
	// 通用错误 1000 - 1100
	//============================================================================


	/** END  */
	END("9999","失败");

	ErrorType(String code, String message){
		this.code = code;
		this.message = message;
	}

	private String code;

	private String message;


	@Override
	public String toString() {
		return "ErrorType{" +
				"code='" + code + '\'' +
				", message='" + message + '\'' +
				'}';
	}
}
